# 作业
#pragma once
template <typename E, int M>
struct sqlist
{
    E elem[M];
    int length;
};
template <typename E, int M>
void Initlist(sqlist<E,M>&L)
{
    L.length = 0;
}
template <typename E, int M>
void Initlist(sqlist<E,M>&L,int i,E e)
{
    if (L.length == N)
         throw"L is full";
    if (i <1|| i>L.length + 1)
         throw"Invalid i";
    for (int j =L.length - 1；j >= i - 1; j--)
        L.elem[j + 1] = L.elem[j];
    L.elem[i - 1] = e;
    L.length++;
}
template <typename E, int M>
void Initlist(sqlist<E,M>&L,int i,E &e)
{
    if (L.length == 0)
        throw"L is empty";
    if (i < 1 || i > L.length)
        throw"Invalid i";
    e = L.elem[i - 1];
    for (int j = i; j<L.length; j++)
        L.elem[j - 1] = L.elem[j];
        L.length--;
}